import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useNavigationParamsStore = defineStore(
  'navigationParams',
  () => {
    const navigationParams = ref(null)

    // 设置跳转参数
    const setNavigationParams = (params: Record<string, any>) => {
      navigationParams.value = params
    }

    // 清空跳转参数
    const clearNavigationParams = () => {
      navigationParams.value = null
    }

    return {
      navigationParams,
      setNavigationParams,
      clearNavigationParams,
    }
  },
  {
    persist: false,
  },
)
